package com.tang.common.enums;

import com.baomidou.mybatisplus.annotation.EnumValue;
import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonValue;
import lombok.Getter;

/**
 * @author tang jun liang
 * @Date 2023-06-27 09:34:14
 */
@Getter
public enum AliPayType {
    /**
     * 支付宝支付类型
     */
    HUA_BEI(10001, "花呗支付"),

    FACE_TO_FACE(10002, "面对面支付"),

    PAGE(10003, "pc网站支付"),

    WAP(10004, "手机h5支付"),

    APP(10005, "app支付"),

    UNKNOWN(0, "未知")
    ;


    @JsonValue
    @EnumValue
    private final Integer value;

    private final String desc;

    AliPayType(Integer value, String desc) {
        this.value = value;
        this.desc = desc;
    }


    @JsonCreator
    public static AliPayType create(Integer value){
        for (AliPayType item: values()){
            if (item.getValue().equals(value)){
                return item;
            }
        }
        return UNKNOWN;
    }

}
